<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements.  See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.  The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License.  You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied.  See the License for the
specific language governing permissions and limitations
under the License.
-->
<div>
  <p>
    <a routerLink="/createmeasure" style="background-color: #337ab7;" class="btn btn-primary  btn-wide">
      <i class="fa fa-plus"></i>
      Create Measure
    </a>
  </p>
  <div id="modelContainer">
    <table class="table table-striped" [mfData]="results" #mf="mfDataTable" [mfRowsOnPage]="10">
      <thead>
      <tr style="background-color:#7D95CC">
        <th st-ratio="15">Measure Name</th>
        <th st-ratio="15">Measure Type</th>
        <th st-ratio="20">Description</th>
        <!-- <th st-ratio="5">Group</th> -->
        <th st-ratio="5">Action</th>
      </tr>
      </thead>
      <tbody>
      <tr *ngIf="!results">
        <td colspan="7" style="text-align:center;display:none">No content!</td>
        <!-- <td class="icon" style="border-top-style:none">
          <span class="fa fa-spinner fa-spin fa-3x fa-fw"></span>
        </td> -->
      </tr>
      <tr *ngFor="let row of mf.data">
        <td><a routerLink="/measure/{{row.id}}">{{row.name}}</a></td>
        <td>{{row["dq.type"].toLowerCase()}}</td>
        <td>{{row.description}}</td>
        <td>
          &nbsp;
          <a (click)="remove(row)" title="delete" style="text-decoration:none">
            <i class="fa fa-trash-o po"></i>
          </a> &nbsp;
          <a routerLink="/measure/{{row.id}}" title="subscribe">
            <i class="fa fa-eye"></i>
          </a>
        </td>
      </tr>
      </tbody>
      <tfoot>
      <tr>
        <td colspan="8" class="text-right">
          <mfBootstrapPaginator></mfBootstrapPaginator>
        </td>
      </tr>
      </tfoot>
    </table>
  </div>
  <div class="modal fade" id="deleteConfirmation" role="dialog" #modal tabindex="-1" [ngClass]="{'in': visibleAnimate}"
       *ngIf="deletedRow" [ngStyle]="{'display': visible ? 'block' : 'none', 'opacity': visibleAnimate ? 1 : 0}"
       (click)="onContainerClicked($event)">
    <div class="modal-dialog modal-xg modal-lg">
      <div class="modal-content">
        <div class="modal-header">
          <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
          <h4 class="modal-title">Delete the model with the below information?</h4>
        </div>
        <div class="modal-body">
          <div class="container-fluid" id="deleteContent" style="overflow:auto;">
            <div class="row">
              <h5 class="over-title margin-bottom-15">Basic information</h5>
            </div>
            <!--//row-->
            <div class="row">
              <div class="col-lg-12 col-md-12 col-sm-12">
                <div id="viewrule-definition" class="viewrule-content">
                  <div class="row">
                    <label class="col-md-4 col-lg-4 col-sm-4">
                      Measure Name:
                    </label>
                    <div class="col-md-8 col-lg-8 col-sm-8 " style="color: #fff">
                      {{deletedRow.name}}
                    </div>
                  </div>
                  <div class="row">
                    <label class="col-md-4 col-lg-4 col-sm-4">
                      Measure Definition:
                    </label>
                    <div class="col-md-8 col-lg-8 col-sm-8 " style="color: #fff">
                      {{deletedRow.description}}
                    </div>
                  </div>
                  <div class="row">
                    <label class="col-md-4 col-lg-4 col-sm-4">
                      Measure Type:
                    </label>
                    <div class="col-md-8 col-lg-8 col-sm-8 " style="color: #fff">
                      {{deletedRow["dq.type"].toLowerCase()}}
                    </div>
                  </div>
                  <div class="row" *ngIf="sourceTable">
                    <label class="col-md-4 col-lg-4 col-sm-4">
                      DataAsset:
                    </label>
                    <div class="col-md-8 col-lg-8 col-sm-8" style="color: #fff">
                      {{sourceTable}}&nbsp;&nbsp;{{targetTable}}
                    </div>
                  </div>
                  <div class="row">
                    <label class="col-md-4 col-lg-4 col-sm-4">
                      Owner:
                    </label>
                    <div class="col-md-8 col-lg-8 col-sm-8" style="color: #fff">
                      {{deletedRow.owner}}
                    </div>
                  </div>
                </div>
              </div>
            </div>
            <!--//row-->
          </div>
        </div>
        <div class="modal-footer">
          <p class="delete-alert">If you delete this measure, your running jobs on this measure will also be deleted,
            please be careful!</p>
          <button type="button" id="save" class="btn btn-default" (click)="confirmDelete()">Yes</button>
          <button type="button" class="btn btn-primary" (click)="hide()">No</button>
        </div>
      </div>
    </div>
  </div>
</div>
